/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upf.grupoe.p2ppicture.SearchEngine.implementations;

import edu.upf.grupoe.p2ppicture.SearchEngine.interfaces.Thumbnail;
import java.io.File;
import java.io.Serializable;
import javax.swing.ImageIcon;

/**
 * This class represents a content Thumbnail(image icon)
 * @author marc
 */
public class ThumbnailImpl implements Thumbnail, Serializable{

    private ImageIcon imageIcon = null;
    /**
     * It sets an ImageIcon
     * @param imageIcon ImageIcon
     */
    public void setImageIcon(ImageIcon imageIcon) {
        this.imageIcon = imageIcon;
    }
    /**
     * It returns an ImageIcon
     * @return ImageIcon
     */
    public ImageIcon getImageIcon(){
        return imageIcon;
    }
    /**
     * ThumbnailImpl constructor
     */
    public ThumbnailImpl(String image){
        //convert filepath to java capable if it is a windows system
        // adapt to windows
        String nimage = image;
        if (File.separator.equals("\\")) {
            nimage = nimage.replace("\\", "\\"+"\\");
        }
        imageIcon = new ImageIcon(nimage);
    }
}
